package com.dragon.modules.yuegou.query.product;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dragon.modules.yuegou.entity.product.AttributeEntity;
import com.dragon.modules.yuegou.enums.product.AttributeInputType;
import com.dragon.modules.yuegou.enums.product.AttributeType;
import com.dragon.modules.yuegou.mybatis.Condition;
import com.dragon.modules.yuegou.mybatis.Query;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonUnwrapped;

import java.time.LocalDateTime;

/**
 * 商品规格属性表 动态查询条件
 * 
 * @author px
 * @date 2019-03-29 16:06:34
 * @version 2.0
 */
@JsonInclude(Include.NON_NULL)
public class AttributeQuery extends AttributeEntity implements Query<AttributeEntity> {

    /** 查询条件 */
	@JsonUnwrapped(prefix = "id")
	private Condition<String> idCondition;

    /** 商品类别编号查询条件 */
	@JsonUnwrapped(prefix = "categoryId")
	private Condition<String> categoryIdCondition;

    /** [枚举]属性类型：0-规格-SPEC、1-参数-PARAM查询条件 */
	@JsonUnwrapped(prefix = "type")
	private Condition<AttributeType> typeCondition;

    /** 属性名称查询条件 */
	@JsonUnwrapped(prefix = "attributeName")
	private Condition<String> attributeNameCondition;

    /** [枚举]输入类型：0-手动输入-INPUT、1-单选-SINGLE、2-多选-MULTIPLE查询条件 */
	@JsonUnwrapped(prefix = "inputType")
	private Condition<AttributeInputType> inputTypeCondition;

    /** 排序查询条件 */
	@JsonUnwrapped(prefix = "sort")
	private Condition<Integer> sortCondition;

    /** 创建人ID查询条件 */
	@JsonUnwrapped(prefix = "createdBy")
	private Condition<String> createdByCondition;

    /** 创建时间查询条件 */
	@JsonUnwrapped(prefix = "createdTime")
	private Condition<LocalDateTime> createdTimeCondition;

    /** 更新人ID查询条件 */
	@JsonUnwrapped(prefix = "modifiedBy")
	private Condition<String> modifiedByCondition;

    /** 更新时间查询条件 */
	@JsonUnwrapped(prefix = "modifiedTime")
	private Condition<LocalDateTime> modifiedTimeCondition;

    /** 逻辑删除，1表示已删除,0表示未删除查询条件 */
	@JsonUnwrapped(prefix = "del")
	private Condition<Boolean> delCondition;

    /** 删除人ID查询条件 */
	@JsonUnwrapped(prefix = "delBy")
	private Condition<String> delByCondition;

    /** 删除时间查询条件 */
	@JsonUnwrapped(prefix = "delTime")
	private Condition<LocalDateTime> delTimeCondition;

	/**
	 * 构造一个查询条件对象
	 */
	public AttributeQuery() {
		super();
	}

	/**
	 * 依据实体对象构造一个查询条件对象
	 * 
	 * @param entity 实体对象
	 */
	public AttributeQuery(AttributeEntity entity) {
		super(entity);
	}

	/**
	 * 依据其它查询条件对象的信息构造一个查询条件对象
	 * 
	 * @param other 查询条件对象
	 */
	public AttributeQuery(AttributeQuery other) {
		super(other);
		if(other.idCondition != null) {
			this.idCondition = other.idCondition.copy();
		}
		if(other.categoryIdCondition != null) {
			this.categoryIdCondition = other.categoryIdCondition.copy();
		}
		if(other.typeCondition != null) {
			this.typeCondition = other.typeCondition.copy();
		}
		if(other.attributeNameCondition != null) {
			this.attributeNameCondition = other.attributeNameCondition.copy();
		}
		if(other.inputTypeCondition != null) {
			this.inputTypeCondition = other.inputTypeCondition.copy();
		}
		if(other.sortCondition != null) {
			this.sortCondition = other.sortCondition.copy();
		}
		if(other.createdByCondition != null) {
			this.createdByCondition = other.createdByCondition.copy();
		}
		if(other.createdTimeCondition != null) {
			this.createdTimeCondition = other.createdTimeCondition.copy();
		}
		if(other.modifiedByCondition != null) {
			this.modifiedByCondition = other.modifiedByCondition.copy();
		}
		if(other.modifiedTimeCondition != null) {
			this.modifiedTimeCondition = other.modifiedTimeCondition.copy();
		}
		if(other.delCondition != null) {
			this.delCondition = other.delCondition.copy();
		}
		if(other.delByCondition != null) {
			this.delByCondition = other.delByCondition.copy();
		}
		if(other.delTimeCondition != null) {
			this.delTimeCondition = other.delTimeCondition.copy();
		}
	}

	@Override
	public QueryWrapper<AttributeEntity> toQueryWrapper() {
		QueryWrapper<AttributeEntity> wrapper = new QueryWrapper<>(this);
		if (idCondition != null) {
			idCondition.toWrapper(wrapper, COL_ID);
		}
		if (categoryIdCondition != null) {
			categoryIdCondition.toWrapper(wrapper, COL_CATEGORY_ID);
		}
		if (typeCondition != null) {
			typeCondition.toWrapper(wrapper, COL_TYPE);
		}
		if (attributeNameCondition != null) {
			attributeNameCondition.toWrapper(wrapper, COL_ATTRIBUTE_NAME);
		}
		if (inputTypeCondition != null) {
			inputTypeCondition.toWrapper(wrapper, COL_INPUT_TYPE);
		}
		if (sortCondition != null) {
			sortCondition.toWrapper(wrapper, COL_SORT);
		}
		if (createdByCondition != null) {
			createdByCondition.toWrapper(wrapper, COL_CREATED_BY);
		}
		if (createdTimeCondition != null) {
			createdTimeCondition.toWrapper(wrapper, COL_CREATED_TIME);
		}
		if (modifiedByCondition != null) {
			modifiedByCondition.toWrapper(wrapper, COL_MODIFIED_BY);
		}
		if (modifiedTimeCondition != null) {
			modifiedTimeCondition.toWrapper(wrapper, COL_MODIFIED_TIME);
		}
		if (delCondition != null) {
			delCondition.toWrapper(wrapper, COL_DEL);
		}
		if (delByCondition != null) {
			delByCondition.toWrapper(wrapper, COL_DEL_BY);
		}
		if (delTimeCondition != null) {
			delTimeCondition.toWrapper(wrapper, COL_DEL_TIME);
		}
		return wrapper;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return idCondition 查询条件
	 */
	public Condition<String> id() {
		this.idCondition = new Condition<>();
		return this.idCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return idCondition 查询条件
	 */
	public Condition<String> getIdCondition() {
		return idCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param idCondition 查询条件
	 */
	public void setIdCondition(Condition<String> idCondition) {
		this.idCondition = idCondition;
	}

	/**
	 * 构造并返回商品类别编号查询条件
	 * 
	 * @return categoryIdCondition 商品类别编号查询条件
	 */
	public Condition<String> categoryId() {
		this.categoryIdCondition = new Condition<>();
		return this.categoryIdCondition;
	}
	
	/**
	 * 获取商品类别编号查询条件
	 * 
	 * @return categoryIdCondition 商品类别编号查询条件
	 */
	public Condition<String> getCategoryIdCondition() {
		return categoryIdCondition;
	}

	/**
	 * 设置商品类别编号查询条件
	 * 
	 * @param categoryIdCondition 商品类别编号查询条件
	 */
	public void setCategoryIdCondition(Condition<String> categoryIdCondition) {
		this.categoryIdCondition = categoryIdCondition;
	}

	/**
	 * 构造并返回[枚举]属性类型：0-规格-SPEC、1-参数-PARAM查询条件
	 * 
	 * @return typeCondition [枚举]属性类型：0-规格-SPEC、1-参数-PARAM查询条件
	 */
	public Condition<AttributeType> type() {
		this.typeCondition = new Condition<>();
		return this.typeCondition;
	}
	
	/**
	 * 获取[枚举]属性类型：0-规格-SPEC、1-参数-PARAM查询条件
	 * 
	 * @return typeCondition [枚举]属性类型：0-规格-SPEC、1-参数-PARAM查询条件
	 */
	public Condition<AttributeType> getTypeCondition() {
		return typeCondition;
	}

	/**
	 * 设置[枚举]属性类型：0-规格-SPEC、1-参数-PARAM查询条件
	 * 
	 * @param typeCondition [枚举]属性类型：0-规格-SPEC、1-参数-PARAM查询条件
	 */
	public void setTypeCondition(Condition<AttributeType> typeCondition) {
		this.typeCondition = typeCondition;
	}

	/**
	 * 构造并返回属性名称查询条件
	 * 
	 * @return attributeNameCondition 属性名称查询条件
	 */
	public Condition<String> attributeName() {
		this.attributeNameCondition = new Condition<>();
		return this.attributeNameCondition;
	}
	
	/**
	 * 获取属性名称查询条件
	 * 
	 * @return attributeNameCondition 属性名称查询条件
	 */
	public Condition<String> getAttributeNameCondition() {
		return attributeNameCondition;
	}

	/**
	 * 设置属性名称查询条件
	 * 
	 * @param attributeNameCondition 属性名称查询条件
	 */
	public void setAttributeNameCondition(Condition<String> attributeNameCondition) {
		this.attributeNameCondition = attributeNameCondition;
	}

	/**
	 * 构造并返回[枚举]输入类型：0-手动输入-INPUT、1-单选-SINGLE、2-多选-MULTIPLE查询条件
	 * 
	 * @return inputTypeCondition [枚举]输入类型：0-手动输入-INPUT、1-单选-SINGLE、2-多选-MULTIPLE查询条件
	 */
	public Condition<AttributeInputType> inputType() {
		this.inputTypeCondition = new Condition<>();
		return this.inputTypeCondition;
	}
	
	/**
	 * 获取[枚举]输入类型：0-手动输入-INPUT、1-单选-SINGLE、2-多选-MULTIPLE查询条件
	 * 
	 * @return inputTypeCondition [枚举]输入类型：0-手动输入-INPUT、1-单选-SINGLE、2-多选-MULTIPLE查询条件
	 */
	public Condition<AttributeInputType> getInputTypeCondition() {
		return inputTypeCondition;
	}

	/**
	 * 设置[枚举]输入类型：0-手动输入-INPUT、1-单选-SINGLE、2-多选-MULTIPLE查询条件
	 * 
	 * @param inputTypeCondition [枚举]输入类型：0-手动输入-INPUT、1-单选-SINGLE、2-多选-MULTIPLE查询条件
	 */
	public void setInputTypeCondition(Condition<AttributeInputType> inputTypeCondition) {
		this.inputTypeCondition = inputTypeCondition;
	}

	/**
	 * 构造并返回排序查询条件
	 * 
	 * @return sortCondition 排序查询条件
	 */
	public Condition<Integer> sort() {
		this.sortCondition = new Condition<>();
		return this.sortCondition;
	}
	
	/**
	 * 获取排序查询条件
	 * 
	 * @return sortCondition 排序查询条件
	 */
	public Condition<Integer> getSortCondition() {
		return sortCondition;
	}

	/**
	 * 设置排序查询条件
	 * 
	 * @param sortCondition 排序查询条件
	 */
	public void setSortCondition(Condition<Integer> sortCondition) {
		this.sortCondition = sortCondition;
	}

	/**
	 * 构造并返回创建人ID查询条件
	 * 
	 * @return createdByCondition 创建人ID查询条件
	 */
	public Condition<String> createdBy() {
		this.createdByCondition = new Condition<>();
		return this.createdByCondition;
	}
	
	/**
	 * 获取创建人ID查询条件
	 * 
	 * @return createdByCondition 创建人ID查询条件
	 */
	public Condition<String> getCreatedByCondition() {
		return createdByCondition;
	}

	/**
	 * 设置创建人ID查询条件
	 * 
	 * @param createdByCondition 创建人ID查询条件
	 */
	public void setCreatedByCondition(Condition<String> createdByCondition) {
		this.createdByCondition = createdByCondition;
	}

	/**
	 * 构造并返回创建时间查询条件
	 * 
	 * @return createdTimeCondition 创建时间查询条件
	 */
	public Condition<LocalDateTime> createdTime() {
		this.createdTimeCondition = new Condition<>();
		return this.createdTimeCondition;
	}
	
	/**
	 * 获取创建时间查询条件
	 * 
	 * @return createdTimeCondition 创建时间查询条件
	 */
	public Condition<LocalDateTime> getCreatedTimeCondition() {
		return createdTimeCondition;
	}

	/**
	 * 设置创建时间查询条件
	 * 
	 * @param createdTimeCondition 创建时间查询条件
	 */
	public void setCreatedTimeCondition(Condition<LocalDateTime> createdTimeCondition) {
		this.createdTimeCondition = createdTimeCondition;
	}

	/**
	 * 构造并返回更新人ID查询条件
	 * 
	 * @return modifiedByCondition 更新人ID查询条件
	 */
	public Condition<String> modifiedBy() {
		this.modifiedByCondition = new Condition<>();
		return this.modifiedByCondition;
	}
	
	/**
	 * 获取更新人ID查询条件
	 * 
	 * @return modifiedByCondition 更新人ID查询条件
	 */
	public Condition<String> getModifiedByCondition() {
		return modifiedByCondition;
	}

	/**
	 * 设置更新人ID查询条件
	 * 
	 * @param modifiedByCondition 更新人ID查询条件
	 */
	public void setModifiedByCondition(Condition<String> modifiedByCondition) {
		this.modifiedByCondition = modifiedByCondition;
	}

	/**
	 * 构造并返回更新时间查询条件
	 * 
	 * @return modifiedTimeCondition 更新时间查询条件
	 */
	public Condition<LocalDateTime> modifiedTime() {
		this.modifiedTimeCondition = new Condition<>();
		return this.modifiedTimeCondition;
	}
	
	/**
	 * 获取更新时间查询条件
	 * 
	 * @return modifiedTimeCondition 更新时间查询条件
	 */
	public Condition<LocalDateTime> getModifiedTimeCondition() {
		return modifiedTimeCondition;
	}

	/**
	 * 设置更新时间查询条件
	 * 
	 * @param modifiedTimeCondition 更新时间查询条件
	 */
	public void setModifiedTimeCondition(Condition<LocalDateTime> modifiedTimeCondition) {
		this.modifiedTimeCondition = modifiedTimeCondition;
	}

	/**
	 * 构造并返回逻辑删除，1表示已删除,0表示未删除查询条件
	 * 
	 * @return delCondition 逻辑删除，1表示已删除,0表示未删除查询条件
	 */
	public Condition<Boolean> del() {
		this.delCondition = new Condition<>();
		return this.delCondition;
	}
	
	/**
	 * 获取逻辑删除，1表示已删除,0表示未删除查询条件
	 * 
	 * @return delCondition 逻辑删除，1表示已删除,0表示未删除查询条件
	 */
	public Condition<Boolean> getDelCondition() {
		return delCondition;
	}

	/**
	 * 设置逻辑删除，1表示已删除,0表示未删除查询条件
	 * 
	 * @param delCondition 逻辑删除，1表示已删除,0表示未删除查询条件
	 */
	public void setDelCondition(Condition<Boolean> delCondition) {
		this.delCondition = delCondition;
	}

	/**
	 * 构造并返回删除人ID查询条件
	 * 
	 * @return delByCondition 删除人ID查询条件
	 */
	public Condition<String> delBy() {
		this.delByCondition = new Condition<>();
		return this.delByCondition;
	}
	
	/**
	 * 获取删除人ID查询条件
	 * 
	 * @return delByCondition 删除人ID查询条件
	 */
	public Condition<String> getDelByCondition() {
		return delByCondition;
	}

	/**
	 * 设置删除人ID查询条件
	 * 
	 * @param delByCondition 删除人ID查询条件
	 */
	public void setDelByCondition(Condition<String> delByCondition) {
		this.delByCondition = delByCondition;
	}

	/**
	 * 构造并返回删除时间查询条件
	 * 
	 * @return delTimeCondition 删除时间查询条件
	 */
	public Condition<LocalDateTime> delTime() {
		this.delTimeCondition = new Condition<>();
		return this.delTimeCondition;
	}
	
	/**
	 * 获取删除时间查询条件
	 * 
	 * @return delTimeCondition 删除时间查询条件
	 */
	public Condition<LocalDateTime> getDelTimeCondition() {
		return delTimeCondition;
	}

	/**
	 * 设置删除时间查询条件
	 * 
	 * @param delTimeCondition 删除时间查询条件
	 */
	public void setDelTimeCondition(Condition<LocalDateTime> delTimeCondition) {
		this.delTimeCondition = delTimeCondition;
	}

}
